package cn.com.zsw.gblog.utils;

import cn.com.zsw.gblog.vo.R;
import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author ：shiwangzhou
 * @date ：Created in 2020-10-16 15:19
 * @description：
 */
public class ServletUtils {
    public static void output(HttpServletResponse response, R r) throws IOException {
        response.setStatus(200);
        response.setContentType("application/json");
        response.setCharacterEncoding("utf-8");
        PrintWriter writer = response.getWriter();
        writer.write(JSON.toJSONString(r));
    }
}
